//
//  ShowIntroduceView.m
//  BusinessMarket
//
//  Created by Michael Li on 2018/12/17.
//  Copyright © 2018年 Michael Li. All rights reserved.
//

#import "ShowIntroduceView.h"
#import "ShopSubModel.h"

#import "UIView+TYAlertView.h"
@interface ShowIntroduceView()
@property(nonatomic,strong) UIButton *btn;
@property(nonatomic,strong) UIImageView *iv;
@property(nonatomic,strong) UILabel *shopTitleL;
@property(nonatomic,strong) UILabel *shopPlaceL;
@property(nonatomic,strong) UILabel *contentL;
@end
@implementation ShowIntroduceView
-(instancetype)initWithFrame:(CGRect)frame
{
    if (self = [super initWithFrame:frame]) {
        self.backgroundColor = kWhite;
        self.btn = [[UIButton alloc]initWithFrame:CGRectMake(self.bounds.size.width-40, 0, 40, 40)];
        [self addSubview:self.btn];//ic_mine_popup_close_pressed
        [self.btn setImage:[UIImage imageNamed:@"ic_mine_popup_close_default"] forState:UIControlStateNormal];
        [self.btn addTarget:self action:@selector(clickBtn) forControlEvents:UIControlEventTouchUpInside];
        
        self.iv = [[UIImageView alloc]initWithFrame:CGRectMake((kWidth-60)/2, 40, 60, 60)];
        [self addSubview:self.iv];
        self.iv.layer.masksToBounds = YES;
        self.iv.layer.cornerRadius = 30;
        self.iv.layer.borderColor  = kLabel252Color.CGColor;
        self.iv.layer.borderWidth  = 2;
        
        self.shopTitleL = [[UILabel alloc]initWithFrame:CGRectMake(0, CGRectGetMaxY(self.iv.frame)+20, kWidth, 21)];
        [self addSubview:self.shopTitleL];
        self.shopTitleL.textColor = [UIColor colorWithRed:15/255.0 green:15/255.0 blue:15/255.0 alpha:1];
        self.shopTitleL.textAlignment = NSTextAlignmentCenter;
        
        self.shopPlaceL = [[UILabel alloc]initWithFrame:CGRectMake(0, CGRectGetMaxY(self.shopTitleL.frame)+20, kWidth, 21)];
        self.shopPlaceL.font = [UIFont systemFontOfSize:14];
        self.shopPlaceL.textAlignment = NSTextAlignmentCenter;
        self.shopPlaceL.textColor = kLabel153Color;
        [self addSubview:self.shopPlaceL];
        
        self.contentL = [[UILabel alloc]initWithFrame:CGRectMake(20, CGRectGetMaxY(self.shopPlaceL.frame)+40, kWidth-40, 21)];
//        self.contentL.textAlignment = NSTextAlignmentCenter;
        self.contentL.textColor = kLabel102Color;
        [self addSubview:self.contentL];
    }
    return self;
}
- (void)setModel:(ShopSubModel *)model
{
    _model = model;
    [self.iv sd_setImageWithURL:[NSURL URLWithString:model.logo] placeholderImage:[UIImage imageNamed:@"headImg"]];
    self.shopTitleL.text = model.title;
    self.shopPlaceL.text = model.city;
    self.contentL.text = model.represent;
}
-(void)clickBtn
{
    [self hideView];
}
@end
